package cn.iocoder.yudao.module.dish.dal.mysql.dishCategory;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dish.dal.dataobject.dishCategory.DishCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dish.controller.admin.dishCategory.vo.*;

/**
 * 餐品分类 Mapper
 *
 * @author 吕小文
 */
@Mapper
public interface DishCategoryMapper extends BaseMapperX<DishCategoryDO> {

    default PageResult<DishCategoryDO> selectPage(DishCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DishCategoryDO>()
                .eqIfPresent(DishCategoryDO::getBrandId, reqVO.getBrandId())
                .likeIfPresent(DishCategoryDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(DishCategoryDO::getCategoryAbstract, reqVO.getCategoryAbstract())
                .eqIfPresent(DishCategoryDO::getLogoKey, reqVO.getLogoKey())
                .eqIfPresent(DishCategoryDO::getSubjectKey, reqVO.getSubjectKey())
                .eqIfPresent(DishCategoryDO::getSort, reqVO.getSort())
                .eqIfPresent(DishCategoryDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DishCategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DishCategoryDO::getId));
    }

}